<?php
class Customer extends CI_Model{
	var $firstname = "";
	var $lastname = "";
	var $email = "";
	function __construct(){
		parent:: __construct();
	
	}	
	
	function create(){
		$data = array('firstname' => $_GET['firstname']);
		$this->firstname=$_GET['firstname'];
		$this->lastname=$_GET['lastname'];
		$this->email=$_GET['emails'];
		$this->db->insert('customer',$data);
		$query->firstname;
		
		
	}
	
	function update(){
		$this->firstName=$_POST['firstname'];
		$this->lastName=$_POST['lastname'];
		$this->email=$_POST['emails'];
		$this->db->update('customer',$this, array('id'=>$_POST['customerCode']));
	}
	
	function search(){
		$query=$this->db->get();
	}
	
	function delete(){
	}
	
	function getcode()
	{
		$this->db->order_by("customerCode", "desc"); 
		$query=$this->db->select('customerCode');
		$this->db->get('customer');
		
		echo "<pre>";
		foreach ($query->result() as $row)
		{
    		echo $row->customerCode;
		}
	}
}
?>
